package com.hit.RuningGirl.main;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class Yelling extends Game {

    public static final String TAG = "PKUHackGame";

    public static final String TITLE = "YellingMan";

    public static final int ViewPort_WIDTH = 720;

    public static final int ViewPort_HEIGHT = 450;

    public static final int Scale = 2;

    private SpriteBatch batch;

    private OrthographicCamera camera;

    private OrthographicCamera uiCam;

    public static com.hit.RuningGirl.screen.MainScreen mainScreen;

    public static com.hit.RuningGirl.screen.GameScreen gameScreen;

    public static AssetManager assetManager;

    static Callback callback;

    static int myLevel = 1;

    public interface Callback {
        public abstract int getLevelOfSound();
    }

    public static int getMyLevel() {
        myLevel = callback.getLevelOfSound();
        return myLevel;
    }

    public Yelling(Callback callback) {
        this.callback = callback;

    }

    @Override
    public void create() {

        assetManager = new AssetManager();

        assetManager.load("images/stars.png", Texture.class);
        assetManager.load("images/start.png", Texture.class);
        assetManager.load("images/gamebg.png", Texture.class);
        assetManager.load("images/s_patch.png", Texture.class);
        assetManager.load("images/yellingman.png", Texture.class);
        assetManager.load("images/init.png", Texture.class);
        assetManager.load("images/platformBase2.png", Texture.class);
        assetManager.load("images/trap.png", Texture.class);
        assetManager.load("images/girl.png", Texture.class);
        assetManager.load("images/flame.png", Texture.class);

        assetManager.load("images/buttonStart.png", Texture.class);
        assetManager.load("images/buttonEnd.png", Texture.class);
        assetManager.load("images/starUI.png", Texture.class);

        assetManager.load("audio/music.ogg", Music.class);
        assetManager.load("audio/contact.wav", Sound.class);
        assetManager.load("audio/jump.wav", Sound.class);
        assetManager.load("audio/select.wav", Sound.class);
        assetManager.load("audio/schnappi.mp3", Music.class);
        assetManager.load("audio/jiaosheng.wav", Sound.class);

        assetManager.finishLoading();


        batch = new SpriteBatch();
        //创建正交摄像机
        camera = new OrthographicCamera();

        camera.setToOrtho(false, ViewPort_WIDTH, ViewPort_HEIGHT);

        uiCam = new OrthographicCamera();

        uiCam.setToOrtho(false, ViewPort_WIDTH, ViewPort_HEIGHT);
        //菜单页面
        mainScreen = new com.hit.RuningGirl.screen.MainScreen(this);
        //游戏页面
        gameScreen = new com.hit.RuningGirl.screen.GameScreen(this);

        setScreen(mainScreen);
    }

    public SpriteBatch getBatch() {
        return batch;
    }

    public OrthographicCamera getCamera() {
        return camera;
    }

    public OrthographicCamera getUiCam() {
        return uiCam;
    }
}
